package com.kehao.newcoder;

import java.util.Arrays;
import java.util.OptionalInt;
import java.util.concurrent.ForkJoinPool;

public class NC19Solution {

    public int FindGreatestSumOfSubArray1(int[] array) {
        int[] dp = new int[array.length];
        dp[0] = array[0];
        int result = array[0];
        for (int i = 1; i < array.length; i++) {
            dp[i] = Integer.max(dp[i-1]+array[i],array[i]);
            result = Integer.max(result,dp[i]);
        }
        return result;
    }
}
